package com.suxin.nio;

import java.nio.IntBuffer;

/**
 * @Classname BufferTest
 * @Description [ TODO ]
 * @Author Tang
 * @Date 2020/12/27 18:54
 * @Created by ASUS
 */
public class BufferTest {

    public static void main(String[] args) {

        IntBuffer intBuffer = IntBuffer.allocate(5);

        for (int i = 0; i < intBuffer.capacity(); i++) {
            intBuffer.put(i * 2);
        }

        intBuffer.flip();
        while (intBuffer.hasRemaining()) {
            System.out.println(intBuffer.get());
        }

    }

}